package cn.jinjimi.framework.router.impl;

import android.content.Intent;

import javax.annotation.Nullable;

import cn.jinjimi.app.AppContext;
import cn.jinjimi.app.controller.event.DataEvent;
import cn.jinjimi.base.util.AndroidUtils;

/**
 * 生成跳转界面的执行类型
 * <p>
 *
 * @author jinsen
 * @date 15/9/17
 */
public class RTaskFactory {
    @Nullable
    public static IRTask buildRTask(Object obj) {
        IRTask doTask = null;
        if (obj instanceof String) {
            Intent intent = new Intent();
            intent.setClassName("cn.jinjimi.app", (String) obj);
            doTask = new IntentRTask(intent);
        } else if (obj instanceof DataEvent) {
            doTask = new EventRTask(obj);
        } else if (obj instanceof DirectRoute) {
            doTask = new DirectTask((DirectRoute) obj);
        }
        return doTask;
    }

}
